package top.wugy.blog.routes;

import com.jfinal.template.Directive;
import com.jfinal.template.Env;
import com.jfinal.template.stat.Scope;
import top.wugy.blog.model.TBlog;
import top.wugy.blog.model.TLink;

import java.io.Writer;

/**
 * wugy on 2017/11/8 17:29
 */
public class BlogDirective extends Directive {

    @Override
    public void exec(Env env, Scope scope, Writer writer) {
        TBlog dao = TBlog.dao;
        scope.setLocal("tagList", dao.tagList());
        scope.setLocal("archives", dao.archives());
        scope.setLocal("linkList", TLink.dao.findAll());
        stat.exec(env, scope, writer);
    }

    @Override
    public boolean hasEnd() {
        return true;
    }
}
